package com.panopset.flywheel;

import java.io.StringWriter;

/**
 * <h5>t - Template</h5>
 *
 * <p>Example 1</p>
 * <pre>
 * ${&#064;t someTemplateFile.txt}
 * </pre>
 *
 * <p>Example 2</p>
 * <pre>
 * ${&#064;p templateName}someTemplateFile.txt${&#064;q}
 * ${&#064;t &#064;templateName}
 * </pre>
 *
 * Continue execution using the supplied template file.
 * @author Karl Dinwiddie
 */
public class CommandTemplate extends TemplateDirectiveCommand {
    public Command lastCommand;

    public static String getShortHTMLText() {
        return "${&#064;t someTemplateFile.txt}";
    }

    public CommandTemplate(String source, String innerPiece, Template template) {
        super(source, innerPiece, template);
    }

    @Override
    public void resolve(StringWriter sw) {
        new Template(template.flywheel, new SourceFile(template.flywheel,
                getParams())).exec(sw);
    }
}
